#include<iostream>
using namespace std;
const int N = 20;
int a[N];
int n, l, r, x;
int ans;
void dfs(int u, int last, int sum, int mi, int ma)
{
	if (u >= 2) {
		if (ma - mi >= x && sum >= l && sum <= r)ans++;
	}
	for (int i = last; i <= n; i++) {
		int t1 = min(mi, a[i]);
		int t2 = max(ma, a[i]);
		dfs(u + 1, i + 1, sum + a[i], t1, t2);
	}
}
int main()
{
	cin >> n >> l >> r >> x;
	for (int i = 1; i <= n; i++)cin >> a[i];
	dfs(1, 2, a[1], a[1], a[1]);
	cout << ans << endl;
	return 0;
}